package _996FangWenZhe.impl;

import _996FangWenZhe.ComputerPart;
import _996FangWenZhe.ComputerPartVisitor;

/**
 * @Computer:
 * @author: ZBoHang
 * @time: 2021/9/18 8:54
 */
public class Computer implements ComputerPart {
    ComputerPart[] parts;

    public Computer() {
        parts = new ComputerPart[] {new Mouse(), new KeyBoard(), new Monitor()};
    }

    @Override
    public void accept(ComputerPartVisitor computerPartVisitor) {
        for (int i = 0, len = parts.length; i < len; i++) {
            parts[i].accept(computerPartVisitor);
        }
        computerPartVisitor.visit(this);
    }
}
